package com.liaogui.web.verify;

import com.liaogui.order.api.domain.ActInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 校验活动基础信息
 * @author liaogui
 * @date 2025/2/27 22:31
 */
@Component
@Order(0)
@RequiredArgsConstructor
@Slf4j
public class ActivityVerifyHandler implements VerifyHandler {

    private final RedisTemplate<String, Object> redisTemplate;
    @Override
    public void operator(ActInfo actInfo) {
        log.info("执行活动校验处理器");
        String actId = "ACT202502281645";
        String actIdKey = "DRAW:" + actInfo.getActId();
        Map<Object, Object> actInfoMap = redisTemplate.opsForHash().entries(actIdKey);
        if (actInfoMap.isEmpty()) {
            throw new RuntimeException("活动不存在");
        }
        actInfo.setActInfo(actInfoMap);
        // 是否存在该活动

        // 是否在有效期

        // 是否有效



    }
}
